import { HttpException, HttpStatus } from "@nestjs/common";
import { ApiErrorCode } from "../../ShareModule/enums/api-error-code";

export class ApiException extends HttpException {
    private errorMessage: string;
    private errorCode: number;

    constructor(errorMessage: string, errorCode: ApiErrorCode, statusCode: HttpStatus) {
        super(errorMessage, statusCode);

        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    getErrorCode(): ApiErrorCode {
        return this.errorCode;
    }

    getErrorMessage(): string {
        return this.errorMessage;
    }
}

export class ApiResponse {
    constructor(private readonly data: any, private readonly code: number, private readonly message: string) {

    }
}